package cn.tedu.egmvc2.controller;

import cn.tedu.egmvc2.pojo.dto.EmpDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class EmpController {
    @RequestMapping("/emp/add")
    @ResponseBody
    public String add(EmpDTO empDTO){
        String name = empDTO.getName();
        double salary = empDTO.getSalary();
        String job = empDTO.getJob();
        System.out.println("姓名:"+name+",工资:"+salary+",职位:"+job);
        return "添加成功";
    }
    @RequestMapping("/emp/list")
    @ResponseBody
    public String selectEmp(EmpDTO empDTO){
        System.out.println(empDTO.toString());
        return "查询成功";
    }
    @RequestMapping("/emp/update")
    @ResponseBody
    public String upEmp(EmpDTO empDTO){
        int id = empDTO.getId();
        String name = empDTO.getName();
        double salary = empDTO.getSalary();
        String job = empDTO.getJob();
        System.out.println("员工id"+id+"姓名:"+name+",工资:"+salary+",职位:"+job);
        return "修改成功";
    }


}
